<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>对特定对象调用用户方法</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.call-user-method" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">call_user_method</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">call_user_method</span> &mdash; <span class="dc-title">对特定对象调用用户方法</span></p>

 </div>
 <div id="function.call-user-method-refsynopsisdiv">
  <div class="warning"><strong class="warning">Warning</strong>
   
<p class="para">
 This function was <em class="emphasis">DEPRECATED</em> in PHP 4.1.0, and
 <em class="emphasis">REMOVED</em> in PHP 7.0.0.
</p>
<p class="para">
 Alternatives to this function include:
</p>

   <ul class="simplelist">
    <li class="member"><span class="function"><a href="call_user_func.html" class="function">call_user_func()</a></span></li>
   </ul>
  </div>
 </div>

 <div class="refsect1 description" id="refsect1-function.call-user-method-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>call_user_method</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$method_name</code></span>
   , <span class="methodparam"><span class="type">object</span> <code class="parameter reference">&$obj</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$parameter</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$...</code></span>
  ]] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>

 </div>
 
 
 <div class="refsect1 parameters" id="refsect1-function.call-user-method-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">method_name</code></dt>

     <dd>

      <p class="para">
       要调用的方法名称。
      </p>
     </dd>

    
    
     <dt>

      <code class="parameter">obj</code>
     </dt>

     <dd>

      <p class="para">
       要调用的 <code class="parameter">method_name</code> 所在的对象  <span class="type"><a href="language.types.object.html" class="type object">object</a></span>。
      </p>
     </dd>

    
    
     <dt>

      <code class="parameter">parameter ...</code>
     </dt>

     <dd>

      <p class="para">
       可选参数
      </p>
     </dd>

    
   </dl>

  </p>
 </div>
 
 <div class="refsect1 examples" id="refsect1-function.call-user-method-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-6129">
    <p><strong>Example #1 代替 <span class="function"><strong>call_user_method()</strong></span> </strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />call_user_func</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$obj</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$method_name</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">$parameter&nbsp;</span><span style="color: #FF8000">/*&nbsp;,&nbsp;...&nbsp;*/</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.call-user-method-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="call_user_func_array.html" class="function" rel="rdfs-seeAlso">call_user_func_array()</a> - 调用回调函数，并把一个数组参数作为回调函数的参数</span></li>
    <li class="member"><span class="function"><a href="call_user_func.html" class="function" rel="rdfs-seeAlso">call_user_func()</a> - 把第一个参数作为回调函数调用</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>